import { Global, Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { UserSchema } from './schemas/user.schemas';

const MONGO_MODEL = MongooseModule.forFeature([
    {
        name: "USER_MODEL",
        schema: UserSchema,
        collection: 'user'
    }
])

@Global()
@Module({
    imports: [
        MongooseModule.forRoot('mongodb://localhost:27017/nest'),
        MONGO_MODEL
    ],
    exports: [MONGO_MODEL]
})
export class DbModule {}
